<template>
    <a-space>
      <a-button type="primary" @click="visible = true">设置网关</a-button>
      <a-button type="primary" @click="headerVisible = true">默认公共请求头</a-button>
    </a-space>

  <!-- 新增网关弹框 -->
  <AddGetWay v-model:visible="visible" @save="handleGetway" :getway="getway" />
  <!-- 公用请求头设置 -->
  <AddHeader v-model:visible="headerVisible" />
</template>
<script lang="ts">
import { defineComponent, ref } from "vue";
import { PlusOutlined } from "@ant-design/icons-vue";
import AddGetWay from "./components/addGetWay.vue";
import AddHeader from "./components/addHeader.vue";
import { getway } from "@/settings/local";
export default defineComponent({
  components: {
    PlusOutlined,
    AddGetWay,
    AddHeader,
  },
  setup(props, { emit }) {
    const current = ref(["1"]);
    const visible = ref(false);
    const headerVisible = ref(false);

    function handleSelectKey({ item, key, selectedKeys }: any) {
      current.value = selectedKeys;
    }

    function handleGetway(_getway: string) {
      getway.value = _getway;
    }

    return {
      current,
      handleSelectKey,
      visible,
      headerVisible,
      getway,
      handleGetway,
    };
  },
});
</script>
